<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace web\api\controller;

/**
 * Description of System
 *
 * @author shilinqing
 */
class System extends ApiBase{
    
    
    public function getPosters(){
        try{
            $posterM = new \addons\config\model\SysPoster();
            return $this->successJSON($posterM->getDataList($this->getPageIndex(), $this->getPageSize()));
            
        } catch (\Exception $ex) {
            return $this->failJSON($ex->getMessage());
        }
    }

    /**
     * 轮播图片
     * @return type
     */
    public function sliders(){
        try{
            $m = new \addons\config\model\Slider();
            $map = [];
            $type = $this->_post('type')==1?1:2;
            $map['type'] = $type;
            $data = $m->where($map)->order('order_index asc')->select();
            return $this->successJSON($data);
        } catch (\Exception $ex) {
            return $this->failJSON($ex->getMessage());
        }
    }

}
